CMAKE_MINIMUM_REQUIRED( VERSION 2.6 )

PROJECT( Contrast )

FILE( GLOB LIB glew.c glsw.c *.h vmath.hpp )

FILE( GLOB MAIN_CPP  *.cpp)
FILE( GLOB MAIN_H    *.hpp)
FILE( GLOB MAIN_GLSL *.glsl *.cl )

ADD_DEFINITIONS( -DGLEW_STATIC )

INCLUDE_DIRECTORIES( . $ENV{CUDA_INC_PATH} )
LINK_DIRECTORIES( $ENV{CUDA_LIB_PATH} )

IF( WIN32 )

    ADD_LIBRARY( tinylib ${LIB} pez.win.c )
    SOURCE_GROUP( "Shaders" FILES ${MAIN_GLSL} )
    SOURCE_GROUP( "Build" FILES CMakeLists.txt )
    ADD_DEFINITIONS( /wd4996 )
    SET( PLATFORM_LIBS opengl32 OpenCL )
    SET( CONSOLE_SYSTEM WIN32 )

ELSE()

    ADD_LIBRARY( tinylib ${LIB} pez.x11.c )

ENDIF()

ADD_EXECUTABLE( Contrast ${CONSOLE_SYSTEM}
    ${MAIN_GLSL}
    ${MAIN_CPP}
    ${MAIN_H}
)

TARGET_LINK_LIBRARIES( Contrast tinylib ${PLATFORM_LIBS} )
